/**
 * 
 */
package dms.service;

import java.util.Date;

import dms.model.Building;
import dms.model.Dormitory;
import dms.model.exception.NoSuchEntityException;
import dms.model.form.Mail;
import dms.model.role.Student;
import dms.model.util.PageIterator;

/**
 * @author 李健
 *
 */
public interface MailQueryService {
	
	Mail findById(Long id);
	
	PageIterator<Mail> findByStudent(int start, int count, Student student, Date fromDate, Date toDate);
	
	PageIterator<Mail> findByBuilding(int start, int count, Building building, Date fromDate, Date toDate);
	
	PageIterator<Mail> findByBuildingAndStudent(int start, int count, Building building, String student, Date fromDate, Date toDate);
	
	PageIterator<Mail> findByDormitory(int start, int count, Dormitory dormitory, Date fromDate, Date toDate);
	
	/**
	 * 如果找不这个ID的寝室，抛出异常没有该寝室
	 * @param start
	 * @param count
	 * @param dormitoryId
	 * @param fromDate
	 * @param toDate
	 * @return
	 * @throws NoSuchEntityException
	 */
	PageIterator<Mail> findByDormitory(int start, int count, long dormitoryId, Date fromDate, Date toDate) throws NoSuchEntityException;
}
